home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsIPresShell.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  27KB  |  753 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  * ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *   Steve Clark <buster@netscape.com>
  24.  *   Dan Rosen <dr@netscape.com>
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  28.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK *****
  39.  *
  40.  * This Original Code has been modified by IBM Corporation.
  41.  * Modifications made by IBM described herein are
  42.  * Copyright (c) International Business Machines
  43.  * Corporation, 2000
  44.  *
  45.  * Modifications to Mozilla code or documentation
  46.  * identified per MPL Section 3.3
  47.  *
  48.  * Date         Modified by     Description of modification
  49.  * 05/03/2000   IBM Corp.       Observer related defines for reflow
  50.  */
  51. #ifndef nsIPresShell_h___
  52. #define nsIPresShell_h___
  53.  
  54. #include "nsISupports.h"
  55. #include "nsCoord.h"
  56. #include "nsEvent.h"
  57. #include "nsReflowType.h"
  58. #include "nsCompatibility.h"
  59. #include "nsCOMArray.h"
  60. #include "nsFrameManagerBase.h"
  61. #include "mozFlushType.h"
  62. #include "nsWeakReference.h"
  63. #include <stdio.h> // for FILE definition
  64.  
  65. class nsIAtom;
  66. class nsIContent;
  67. class nsIContentIterator;
  68. class nsIDocument;
  69. class nsIDocumentObserver;
  70. class nsIFrame;
  71. class nsPresContext;
  72. class nsStyleSet;
  73. class nsIViewManager;
  74. class nsIDeviceContext;
  75. class nsIRenderingContext;
  76. class nsIPageSequenceFrame;
  77. class nsString;
  78. class nsAString;
  79. class nsStringArray;
  80. class nsICaret;
  81. class nsStyleContext;
  82. class nsIFrameSelection;
  83. class nsFrameManager;
  84. class nsILayoutHistoryState;
  85. class nsIReflowCallback;
  86. class nsISupportsArray;
  87. class nsIDOMNode;
  88. class nsIStyleFrameConstruction;
  89. class nsIStyleSheet;
  90. class nsCSSFrameConstructor;
  91. class nsISelection;
  92.  
  93. #define NS_IPRESSHELL_IID     \
  94. { 0x0672be76, 0x1047, 0x4905, \
  95.   {0xad, 0xd1, 0xc5, 0xc6, 0x90, 0xe8, 0x70, 0x3a} }
  96.  
  97. // Constants uses for ScrollFrameIntoView() function
  98. #define NS_PRESSHELL_SCROLL_TOP      0
  99. #define NS_PRESSHELL_SCROLL_BOTTOM   100
  100. #define NS_PRESSHELL_SCROLL_LEFT     0
  101. #define NS_PRESSHELL_SCROLL_RIGHT    100
  102. #define NS_PRESSHELL_SCROLL_CENTER   50
  103. #define NS_PRESSHELL_SCROLL_ANYWHERE -1
  104. #define NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE -2
  105.  
  106. // debug VerifyReflow flags
  107. #define VERIFY_REFLOW_ON              0x01
  108. #define VERIFY_REFLOW_NOISY           0x02
  109. #define VERIFY_REFLOW_ALL             0x04
  110. #define VERIFY_REFLOW_DUMP_COMMANDS   0x08
  111. #define VERIFY_REFLOW_NOISY_RC        0x10
  112. #define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
  113. #define VERIFY_REFLOW_INCLUDE_SPACE_MANAGER 0x40
  114. #define VERIFY_REFLOW_DURING_RESIZE_REFLOW  0x80
  115.  
  116. #ifdef IBMBIDI // Constant for Set/Get CaretBidiLevel
  117. #define BIDI_LEVEL_UNDEFINED 0x80
  118. #endif
  119.  
  120. // for PostAttributeChanged
  121. enum nsAttributeChangeType {
  122.   eChangeType_Set = 0,       // Set attribute
  123.   eChangeType_Remove = 1     // Remove attribute
  124. };
  125.  
  126. /**
  127.  * Presentation shell interface. Presentation shells are the
  128.  * controlling point for managing the presentation of a document. The
  129.  * presentation shell holds a live reference to the document, the
  130.  * presentation context, the style manager, the style set and the root
  131.  * frame. <p>
  132.  *
  133.  * When this object is Release'd, it will release the document, the
  134.  * presentation context, the style manager, the style set and the root
  135.  * frame.
  136.  */
  137.  
  138. // hack to make egcs / gcc 2.95.2 happy
  139. class nsIPresShell_base : public nsISupports
  140. {
  141. public:
  142.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_IID)
  143. };
  144.  
  145. class nsIPresShell : public nsIPresShell_base
  146. {
  147. public:
  148.   NS_IMETHOD Init(nsIDocument* aDocument,
  149.                   nsPresContext* aPresContext,
  150.                   nsIViewManager* aViewManager,
  151.                   nsStyleSet* aStyleSet,
  152.                   nsCompatibility aCompatMode) = 0;
  153.  
  154.   /**
  155.    * All callers are responsible for calling |Destroy| after calling
  156.    * |EndObservingDocument|.  It needs to be separate only because form
  157.    * controls incorrectly store their data in the frames rather than the
  158.    * content model and printing calls |EndObservingDocument| multiple
  159.    * times to make form controls behave nicely when printed.
  160.    */
  161.   NS_IMETHOD Destroy() = 0;
  162.  
  163.   // All frames owned by the shell are allocated from an arena.  They are also recycled
  164.   // using free lists (separate free lists being maintained for each size_t).
  165.   // Methods for recycling frames.
  166.   virtual void* AllocateFrame(size_t aSize) = 0;
  167.   virtual void  FreeFrame(size_t aSize, void* aFreeChunk) = 0;
  168.  
  169.   // Dynamic stack memory allocation
  170.   NS_IMETHOD PushStackMemory() = 0;
  171.   NS_IMETHOD PopStackMemory() = 0;
  172.   NS_IMETHOD AllocateStackMemory(size_t aSize, void** aResult) = 0;
  173.   
  174.   nsIDocument* GetDocument() { return mDocument; }
  175.  
  176.   nsPresContext* GetPresContext() { return mPresContext; }
  177.  
  178.   nsIViewManager* GetViewManager() { return mViewManager; }
  179.  
  180. #ifdef _IMPL_NS_LAYOUT
  181.   nsStyleSet*  StyleSet() { return mStyleSet; }
  182.  
  183.   nsCSSFrameConstructor* FrameConstructor()
  184.   {
  185.     return mFrameConstructor;
  186.   }
  187.  
  188.   nsFrameManager* FrameManager() const {
  189.     return NS_REINTERPRET_CAST(nsFrameManager*,
  190.       &NS_CONST_CAST(nsIPresShell*, this)->mFrameManager);
  191.   }
  192.  
  193. #endif
  194.  
  195.   // These two methods are used only by viewer
  196.   NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
  197.  
  198.   NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle) = 0;
  199.  
  200.  
  201.   /* Enable/disable author style level. Disabling author style disables the entire
  202.    * author level of the cascade, including the HTML preshint level.
  203.    */
  204.   // XXX these could easily be inlined, but there is a circular #include
  205.   // problem with nsStyleSet.
  206.   NS_HIDDEN_(void) SetAuthorStyleDisabled(PRBool aDisabled);
  207.   NS_HIDDEN_(PRBool) GetAuthorStyleDisabled();
  208.  
  209.   /*
  210.    * Called when stylesheets are added/removed/enabled/disabled to rebuild
  211.    * all style data for a given pres shell without necessarily reconstructing
  212.    * all of the frames.
  213.    */
  214.   virtual NS_HIDDEN_(void) ReconstructStyleDataExternal();
  215.   NS_HIDDEN_(void) ReconstructStyleDataInternal();
  216. #ifdef _IMPL_NS_LAYOUT
  217.   void ReconstructStyleData() { ReconstructStyleDataInternal(); }
  218. #else
  219.   void ReconstructStyleData() { ReconstructStyleDataExternal(); }
  220. #endif
  221.  
  222.   /** Setup all style rules required to implement preferences
  223.    * - used for background/text/link colors and link underlining
  224.    *    may be extended for any prefs that are implemented via style rules
  225.    * - aForceReflow argument is used to force a full reframe to make the rules show
  226.    *   (only used when the current page needs to reflect changed pref rules)
  227.    *
  228.    * - initially created for bugs 31816, 20760, 22963
  229.    */
  230.   NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow) = 0;
  231.  
  232.   /**
  233.    * Gather titles of all selectable (alternate and preferred) style sheets
  234.    * fills void array with nsString* caller must free strings
  235.    */
  236.   NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
  237.  
  238.   /**
  239.    * FrameSelection will return the Frame based selection API.
  240.    * You cannot go back and forth anymore with QI between nsIDOM sel and
  241.    * nsIFrame sel.
  242.    */
  243.   nsIFrameSelection* FrameSelection() { return mSelection; }
  244.  
  245.   // Make shell be a document observer
  246.   NS_IMETHOD BeginObservingDocument() = 0;
  247.  
  248.   // Make shell stop being a document observer
  249.   NS_IMETHOD EndObservingDocument() = 0;
  250.  
  251.   /**
  252.    * Determine if InitialReflow() was previously called.
  253.    * @param aDidInitialReflow PR_TRUE if InitalReflow() was previously called,
  254.    * PR_FALSE otherwise.
  255.    */
  256.   NS_IMETHOD GetDidInitialReflow(PRBool *aDidInitialReflow) = 0;
  257.  
  258.   /**
  259.    * Perform the initial reflow. Constructs the frame for the root content
  260.    * object and then reflows the frame model into the specified width and
  261.    * height.
  262.    *
  263.    * The coordinates for aWidth and aHeight must be in standard nscoord's.
  264.    */
  265.   NS_IMETHOD InitialReflow(nscoord aWidth, nscoord aHeight) = 0;
  266.  
  267.   /**
  268.    * Reflow the frame model into a new width and height.  The
  269.    * coordinates for aWidth and aHeight must be in standard nscoord's.
  270.    */
  271.   NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight) = 0;
  272.  
  273.   /**
  274.    * Reflow the frame model with a reflow reason of eReflowReason_StyleChange
  275.    */
  276.   NS_IMETHOD StyleChangeReflow() = 0;
  277.  
  278.   /**
  279.    * This calls through to the frame manager to get the root frame.
  280.    * Callers inside of gklayout should use FrameManager()->GetRootFrame()
  281.    * instead, as it's more efficient.
  282.    */
  283.   virtual NS_HIDDEN_(nsIFrame*) GetRootFrame() const;
  284.  
  285.   /**
  286.    * Returns the page sequence frame associated with the frame hierarchy.
  287.    * Returns NULL if not a paginated view.
  288.    */
  289.   NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const = 0;
  290.  
  291.   /**
  292.    * Gets the primary frame associated with the content object. This is a
  293.    * helper function that just forwards the request to the frame manager.
  294.    *
  295.    * The primary frame is the frame that is most closely associated with the
  296.    * content. A frame is more closely associated with the content that another
  297.    * frame if the one frame contains directly or indirectly the other frame (e.g.,
  298.    * when a frame is scrolled there is a scroll frame that contains the frame
  299.    * being scrolled). The primary frame is always the first-in-flow.
  300.    *
  301.    * In the case of absolutely positioned elements and floated elements,
  302.    * the primary frame is the frame that is out of the flow and not the
  303.    * placeholder frame.
  304.    */
  305.   NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
  306.                                 nsIFrame**  aPrimaryFrame) const = 0;
  307.  
  308.   /**
  309.    * Returns a layout object associated with the primary frame for the content object.
  310.    *
  311.    * @param aContent   the content object for which we seek a layout object
  312.    * @param aResult    the resulting layout object as an nsISupports, if found.  Refcounted.
  313.    */
  314.   NS_IMETHOD GetLayoutObjectFor(nsIContent*   aContent,
  315.                                 nsISupports** aResult) const = 0;
  316.  
  317.   /**
  318.    * Gets the placeholder frame associated with the specified frame. This is
  319.    * a helper frame that forwards the request to the frame manager.
  320.    */
  321.   NS_IMETHOD GetPlaceholderFrameFor(nsIFrame*  aFrame,
  322.                                     nsIFrame** aPlaceholderFrame) const = 0;
  323.  
  324.   /**
  325.    * Reflow commands
  326.    */
  327.   NS_IMETHOD AppendReflowCommand(nsIFrame*    aTargetFrame,
  328.                                  nsReflowType aReflowType,
  329.                                  nsIAtom*     aChildListName) = 0;
  330.   // XXXbz don't we need a child list name on this too?
  331.   NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsReflowType* aCmdType) = 0;
  332.   NS_IMETHOD CancelAllReflowCommands() = 0;
  333.  
  334.   /**
  335.    * Recreates the frames for a node
  336.    */
  337.   NS_IMETHOD RecreateFramesFor(nsIContent* aContent) = 0;
  338.  
  339.   /**
  340.    * Determine if it is safe to flush all pending notifications
  341.    * @param aIsSafeToFlush PR_TRUE if it is safe, PR_FALSE otherwise.
  342.    * 
  343.    */
  344.   NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
  345.  
  346.   /**
  347.    * Flush pending notifications of the type specified.  This method
  348.    * will not affect the content model; it'll just affect style and
  349.    * frames. Callers that actually want up-to-date presentation (other
  350.    * than the document itself) should probably be calling
  351.    * nsIDocument::FlushPendingNotifications.
  352.    *
  353.    * @param aType the type of notifications to flush
  354.    */
  355.   NS_IMETHOD FlushPendingNotifications(mozFlushType aType) = 0;
  356.  
  357.   /**
  358.    * Post a request to handle a DOM event after Reflow has finished.
  359.    */
  360.   NS_IMETHOD PostDOMEvent(nsIContent* aContent, nsEvent* aEvent)=0;
  361.  
  362.   /**
  363.    * Post a request to set and attribute after reflow has finished.
  364.    */
  365.   NS_IMETHOD PostAttributeChange(nsIContent* aContent,
  366.                                  PRInt32 aNameSpaceID, 
  367.                                  nsIAtom* aName,
  368.                                  const nsString& aValue,
  369.                                  PRBool aNotify,
  370.                                  nsAttributeChangeType aType) = 0;
  371.  
  372.   NS_IMETHOD PostReflowCallback(nsIReflowCallback* aCallback) = 0;
  373.   NS_IMETHOD CancelReflowCallback(nsIReflowCallback* aCallback) = 0;
  374.  /**
  375.    * Reflow batching
  376.    */   
  377.   NS_IMETHOD BeginReflowBatching() = 0;
  378.   NS_IMETHOD EndReflowBatching(PRBool aFlushPendingReflows) = 0;
  379.   NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
  380.  
  381.   NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
  382.  
  383.   /**
  384.    * Given a frame, create a rendering context suitable for use with
  385.    * the frame.
  386.    */
  387.   NS_IMETHOD CreateRenderingContext(nsIFrame *aFrame,
  388.                                     nsIRenderingContext** aContext) = 0;
  389.  
  390.   /**
  391.    * Notification that we were unable to render a replaced element.
  392.    * Called when the replaced element can not be rendered, and we should
  393.    * instead render the element's contents.
  394.    * The content object associated with aFrame should either be a IMG
  395.    * element, an OBJECT element, or an APPLET element
  396.    */
  397.   NS_IMETHOD CantRenderReplacedElement(nsIFrame* aFrame) = 0;
  398.  
  399.  
  400.   /**
  401.    * Informs the pres shell that the document is now at the anchor with
  402.    * the given name.  If |aScroll| is true, scrolls the view of the
  403.    * document so that the anchor with the specified name is displayed at
  404.    * the top of the window.  If |aAnchorName| is empty, then this informs
  405.    * the pres shell that there is no current target, and |aScroll| must
  406.    * be false.
  407.    */
  408.   NS_IMETHOD GoToAnchor(const nsAString& aAnchorName, PRBool aScroll) = 0;
  409.  
  410.   /**
  411.    * Scrolls the view of the document so that the frame is displayed at the 
  412.    * top of the window.
  413.    *
  414.    * @param aFrame    The frame to scroll into view
  415.    * @param aVPercent How to align the frame vertically. A value of 0
  416.    *                    (NS_PRESSHELL_SCROLL_TOP) means the frame's upper edge is
  417.    *                    aligned with the top edge of the visible area. A value of
  418.    *                    100 (NS_PRESSHELL_SCROLL_BOTTOM) means the frame's bottom
  419.    *                    edge is aligned with the bottom edge of the visible area.
  420.    *                    For values in between, the point "aVPercent" down the frame
  421.    *                    is placed at the point "aVPercent" down the visible area. A
  422.    *                    value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
  423.    *                    vertically. A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
  424.    *                    the frame the minimum amount necessary in order for the entire
  425.    *                    frame to be visible vertically (if possible)
  426.    * @param aHPercent How to align the frame horizontally. A value of 0
  427.    *                    (NS_PRESSHELL_SCROLL_LEFT) means the frame's left edge is
  428.    *                    aligned with the left edge of the visible area. A value of
  429.    *                    100 (NS_PRESSHELL_SCROLL_RIGHT) means the frame's right
  430.    *                    edge is aligned with the right edge of the visible area.
  431.    *                    For values in between, the point "aVPercent" across the frame
  432.    *                    is placed at the point "aVPercent" across the visible area.
  433.    *                    A value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
  434.    *                    horizontally . A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
  435.    *                    the frame the minimum amount necessary in order for the entire
  436.    *                    frame to be visible horizontally (if possible)
  437.    */
  438.   NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame,
  439.                                  PRIntn   aVPercent, 
  440.                                  PRIntn   aHPercent) const = 0;
  441.  
  442.   /**
  443.    * Suppress notification of the frame manager that frames are
  444.    * being destroyed.
  445.    */
  446.   NS_IMETHOD SetIgnoreFrameDestruction(PRBool aIgnore) = 0;
  447.  
  448.   /**
  449.    * Notification sent by a frame informing the pres shell that it is about to
  450.    * be destroyed.
  451.    * This allows any outstanding references to the frame to be cleaned up
  452.    */
  453.   NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
  454.  
  455.   /**
  456.    * Notify the Clipboard that we have something to copy.
  457.    */
  458.   NS_IMETHOD DoCopy() = 0;
  459.  
  460.   /**
  461.    * Get the selection of the focussed element (either the page selection,
  462.    * or the selection for a text field).
  463.    */
  464.   NS_IMETHOD GetSelectionForCopy(nsISelection** outSelection) = 0;
  465.  
  466.   /**
  467.    * Get link location.
  468.    */
  469.   NS_IMETHOD GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocation) = 0;
  470.  
  471.   /**
  472.    * Get the doc or the selection as text or html.
  473.    */
  474.   NS_IMETHOD DoGetContents(const nsACString& aMimeType, PRUint32 aFlags, PRBool aSelectionOnly, nsAString& outValue) = 0;
  475.  
  476.   /**
  477.    * Get the caret, if it exists. AddRefs it.
  478.    */
  479.   NS_IMETHOD GetCaret(nsICaret **aOutCaret) = 0;
  480.  
  481.   /**
  482.    * Should the images have borders etc.  Actual visual effects are determined
  483.    * by the frames.  Visual effects may not effect layout, only display.
  484.    * Takes effect on next repaint, does not force a repaint itself.
  485.    *
  486.    * @param aEnabled  if PR_TRUE, visual selection effects are enabled
  487.    *                  if PR_FALSE visual selection effects are disabled
  488.    * @return  always NS_OK
  489.    */
  490.   NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable) = 0;
  491.  
  492.   /** 
  493.     * Gets the current state of non text selection effects
  494.     * @param aEnabled  [OUT] set to the current state of non text selection,
  495.     *                  as set by SetDisplayNonTextSelection
  496.     * @return   if aOutEnabled==null, returns NS_ERROR_INVALID_ARG
  497.     *           else NS_OK
  498.     */
  499.   NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnabled) = 0;
  500.  
  501.   /**
  502.     * Interface to dispatch events via the presshell
  503.     */
  504.   NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent, 
  505.                                    nsIFrame* aFrame, 
  506.                                    nsIContent* aContent,
  507.                                    PRUint32 aFlags,
  508.                                    nsEventStatus* aStatus) = 0;
  509.  
  510.   /**
  511.    * Dispatch event to content only (NOT full processing)
  512.    */
  513.   NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent,
  514.                             nsEvent* aEvent,
  515.                             nsEventStatus* aStatus) = 0;
  516.  
  517.   /**
  518.     * Gets the current target event frame from the PresShell
  519.     */
  520.   NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame) = 0;
  521.  
  522.   /**
  523.     * Gets the current target event frame from the PresShell
  524.     */
  525.   NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent) = 0;
  526.  
  527.   /**
  528.    * Get and set the history state for the current document 
  529.    */
  530.  
  531.   NS_IMETHOD CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState, PRBool aLeavingPage = PR_FALSE) = 0;
  532.  
  533.   /**
  534.    * Determine if reflow is currently locked
  535.    * @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise
  536.    */
  537.   NS_IMETHOD IsReflowLocked(PRBool* aIsLocked) = 0;  
  538.  
  539.   /**
  540.    * Returns a content iterator to iterate the generated content nodes.
  541.    * You must specify whether you want to iterate the "before" generated
  542.    * content or the "after" generated content. If there is no generated
  543.    * content of the specified type for the promary frame associated with
  544.    * with the content object then NULL is returned
  545.    */
  546.   enum GeneratedContentType {Before, After};
  547.   NS_IMETHOD GetGeneratedContentIterator(nsIContent*          aContent,
  548.                                          GeneratedContentType aType,
  549.                                          nsIContentIterator** aIterator) const = 0;
  550.  
  551.  
  552.   /**
  553.    * Store the nsIAnonymousContentCreator-generated anonymous
  554.    * content that's associated with an element. The new anonymous content
  555.    * is added to whatever anonymous content might already be associated with
  556.    * the element.
  557.    * @param aContent the element with which the anonymous
  558.    *   content is to be associated with
  559.    * @param aAnonymousElements an array of nsIContent
  560.    *   objects, or null to indicate that any anonymous
  561.    *   content should be dissociated from the aContent
  562.    */
  563.   NS_IMETHOD SetAnonymousContentFor(nsIContent* aContent, nsISupportsArray* aAnonymousElements) = 0;
  564.  
  565.   /**
  566.    * Retrieve the nsIAnonymousContentCreator-generated anonymous
  567.    * content that's associated with an element.
  568.    * @param aContent the element for which to retrieve the
  569.    *   associated anonymous content
  570.    * @param aAnonymousElements an array of nsIContent objects,
  571.    *   or null to indicate that there are no anonymous elements
  572.    *   associated with aContent
  573.    */
  574.   NS_IMETHOD GetAnonymousContentFor(nsIContent* aContent, nsISupportsArray** aAnonymousElements) = 0;
  575.  
  576.   /**
  577.    * Release all nsIAnonymousContentCreator-generated
  578.    * anonymous content associated with the shell.
  579.    */
  580.   NS_IMETHOD ReleaseAnonymousContent() = 0;
  581.  
  582.   /**
  583.    * Called to find out if painting is suppressed for this presshell.  If it is suppressd,
  584.    * we don't allow the painting of any layer but the background, and we don't
  585.    * recur into our children.
  586.    */
  587.   NS_IMETHOD IsPaintingSuppressed(PRBool* aResult)=0;
  588.  
  589.   /**
  590.    * Unsuppress painting.
  591.    */
  592.   NS_IMETHOD UnsuppressPainting() = 0;
  593.  
  594.   /**
  595.    * Called to disable nsITheme support in a specific presshell.
  596.    */
  597.   NS_IMETHOD DisableThemeSupport() = 0;
  598.  
  599.   /**
  600.    * Indicates whether theme support is enabled.
  601.    */
  602.   virtual PRBool IsThemeSupportEnabled() = 0;
  603.  
  604.   /**
  605.    * Get the set of agent style sheets for this presentation
  606.    */
  607.   virtual nsresult GetAgentStyleSheets(nsCOMArray<nsIStyleSheet>& aSheets) = 0;
  608.  
  609.   /**
  610.    * Replace the set of agent style sheets
  611.    */
  612.   virtual nsresult SetAgentStyleSheets(const nsCOMArray<nsIStyleSheet>& aSheets) = 0;
  613.  
  614.   /**
  615.    * Add an override style sheet for this presentation
  616.    */
  617.   virtual nsresult AddOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
  618.  
  619.   /**
  620.    * Remove an override style sheet
  621.    */
  622.   virtual nsresult RemoveOverrideStyleSheet(nsIStyleSheet *aSheet) = 0;
  623.  
  624.   /**
  625.    * Reconstruct frames for all elements in the document
  626.    */
  627.   virtual nsresult ReconstructFrames() = 0;
  628.  
  629.   /**
  630.    * See if reflow verification is enabled. To enable reflow verification add
  631.    * "verifyreflow:1" to your NSPR_LOG_MODULES environment variable
  632.    * (any non-zero debug level will work). Or, call SetVerifyReflowEnable
  633.    * with PR_TRUE.
  634.    */
  635.   static PRBool GetVerifyReflowEnable();
  636.  
  637.   /**
  638.    * Set the verify-reflow enable flag.
  639.    */
  640.   static void SetVerifyReflowEnable(PRBool aEnabled);
  641.  
  642.   /**
  643.    * Get the flags associated with the VerifyReflow debug tool
  644.    */
  645.   static PRInt32 GetVerifyReflowFlags();
  646.  
  647. #ifdef MOZ_REFLOW_PERF
  648.   NS_IMETHOD DumpReflows() = 0;
  649.   NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
  650.   NS_IMETHOD PaintCount(const char * aName, 
  651.                         nsIRenderingContext* aRenderingContext, 
  652.                         nsPresContext * aPresContext, 
  653.                         nsIFrame * aFrame,
  654.                         PRUint32 aColor) = 0;
  655.   NS_IMETHOD SetPaintFrameCount(PRBool aOn) = 0;
  656. #endif
  657.  
  658. #ifdef IBMBIDI
  659.   /**
  660.    * SetCaretBidiLevel will set the Bidi embedding level for the cursor. 0-63
  661.    */
  662.   NS_IMETHOD SetCaretBidiLevel(PRUint8 aLevel) = 0;
  663.  
  664.   /**
  665.    * GetCaretBidiLevel will get the Bidi embedding level for the cursor. 0-63
  666.    */
  667.   NS_IMETHOD GetCaretBidiLevel(PRUint8 *aOutLevel) = 0;
  668.  
  669.   /**
  670.    * UndefineCaretBidiLevel will set the Bidi embedding level for the cursor to an out-of-range value
  671.    */
  672.   NS_IMETHOD UndefineCaretBidiLevel(void) = 0;
  673.  
  674.   /**
  675.    * Reconstruct and reflow frame model 
  676.    */
  677.   NS_IMETHOD BidiStyleChangeReflow(void) = 0;
  678. #endif
  679.  
  680. #ifdef DEBUG
  681.   // Debugging hooks
  682.   virtual void ListStyleContexts(nsIFrame *aRootFrame, FILE *out,
  683.                                  PRInt32 aIndent = 0) = 0;
  684.  
  685.   virtual void ListStyleSheets(FILE *out, PRInt32 aIndent = 0) = 0;
  686. #endif
  687.  
  688.   PRBool IsAccessibilityActive() { return mIsAccessibilityActive; }
  689.  
  690.   /**
  691.    * Stop all active elements (plugins and the caret) in this presentation and
  692.    * in the presentations of subdocuments.  Resets painting to a suppressed state.
  693.    * XXX this should include image animations
  694.    */
  695.   virtual void Freeze() = 0;
  696.  
  697.   /**
  698.    * Restarts active elements (plugins) in this presentation and in the
  699.    * presentations of subdocuments, then do a full invalidate of the content area.
  700.    */
  701.   virtual void Thaw() = 0;
  702.  
  703.   /**
  704.    * When this shell is disconnected from its containing docshell, we
  705.    * lose our container pointer.  However, we'd still like to be able to target
  706.    * user events at the docshell's parent.  This pointer allows us to do that.
  707.    * It should not be used for any other purpose.
  708.    */
  709.   void SetForwardingContainer(nsWeakPtr aContainer)
  710.   {
  711.     mForwardingContainer = aContainer;
  712.   }
  713.  
  714. protected:
  715.   // IMPORTANT: The ownership implicit in the following member variables
  716.   // has been explicitly checked.  If you add any members to this class,
  717.   // please make the ownership explicit (pinkerton, scc).
  718.  
  719.   // these are the same Document and PresContext owned by the DocViewer.
  720.   // we must share ownership.
  721.   nsIDocument*              mDocument;      // [STRONG]
  722.   nsPresContext*            mPresContext;   // [STRONG]
  723.   nsStyleSet*               mStyleSet;      // [OWNS]
  724.   nsCSSFrameConstructor*    mFrameConstructor; // [OWNS]
  725.   nsIViewManager*           mViewManager;   // [WEAK] docViewer owns it so I don't have to
  726.   nsIFrameSelection*        mSelection;
  727.   nsFrameManagerBase        mFrameManager;  // [OWNS]
  728.   nsWeakPtr                 mForwardingContainer;
  729.  
  730.   PRPackedBool              mStylesHaveChanged;
  731.  
  732. #ifdef ACCESSIBILITY
  733.   /**
  734.    * Call this when there have been significant changes in the rendering for
  735.    * a content subtree, so the matching accessibility subtree can be invalidated
  736.    */
  737.   void InvalidateAccessibleSubtree(nsIContent *aContent);
  738. #endif
  739.  
  740.   // Set to true when the accessibility service is being used to mirror
  741.   // the dom/layout trees
  742.   PRPackedBool mIsAccessibilityActive;
  743. };
  744.  
  745. /**
  746.  * Create a new empty presentation shell. Upon success, call Init
  747.  * before attempting to use the shell.
  748.  */
  749. nsresult
  750. NS_NewPresShell(nsIPresShell** aInstancePtrResult);
  751.  
  752. #endif /* nsIPresShell_h___ */
  753.